Build Your Own Database Driven Web Site Using PHP & MySQL by Kevin Yank

Build Your Own Database Driven Web Site Using PHP & MySQL by Kevin Yank

Author:Kevin Yank [Yank, Kevin]
Language: eng
Format: epub, mobi, pdf
ISBN: 9780980576818
Publisher: SitePoint Pty. Ltd.
Published: 2009-10-26T16:00:00+00:00


Notice that, because [ normally indicates the start of a set of acceptable characters in a regular expression, we put a backslash before it in order to remove its special meaning.

Similarly, we must escape the forward slash in the [/b] tag with a backslash, to prevent it from being mistaken for the delimiter that marks the end of the regular expression.

Without a matching [, the ] loses its special meaning, so it’s unnecessary to escape it, although you could put a backslash in front of it as well if you wanted to be thorough.

Also notice that, since we’re using the i modifier on each of the two regular expressions to make them case insensitive, both [B] and [b] (as well as [/B] and [/b]) will work as tags in our custom markup language.

Italic text can be achieved in the same way:

$text = preg_replace('/\[I]/i', '<em>', $text); $text = preg_replace('/\[\/I]/i', '</em>', $text);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.